<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // 异步请求
    function getDate(){
        return new Promise((resolve, reject) => {
             setTimeout(()=>{
                resolve(100)
             })    
        })
    }
    async function fun(){
        var result = await getDate()
        console.log(result);
    }
    fun()

    // 任意函数，只要前面加上async，返回的就是promise对象
    async function fun(){
        return 100
    }
    async function main(){
        var result = await fun()
        console.log(reuslt);
    }
    main()
</script>
</html>